package com.software.demo5;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Run {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
        DataSource datasource = ctx.getBean("datasource", DataSource.class);
        DataSource datasource2 = ctx.getBean("datasource", DataSource.class);
        System.out.println(datasource.equals(datasource2));

        AbstractApplicationContext ab = (AbstractApplicationContext) ctx;
        ab.close();
    }
}
